import { defineStore } from "pinia";
import { computed, reactive, ref } from "vue";


// 接下来是组合式API写法
const RecordsCountStore=defineStore('Records',()=>{
    interface a{
        name:string;
    }
    const school=ref('鸿福学校')
    let sum=ref(12)
    // let school=ref('鸿福学校'),
    let address=ref('北京市')
    // 方法
    function increment(value:any){
                    console.log("increament被调用了",value)
                    // 修改数据
                    // console.log(sum);
                    // this代表当前的store对象
                    sum.value+=value;
            // console.log(sum)
    }
    const bigSum=computed(()=>{
        return sum.value*10
    })
    // function bigSum(state:any){
    //                 return state.sum*10;
    //             }
    // function upperSchool(state:any){
    //     // console.log('@@!!',this)
    //     return state.school.toUpperCase()
    // }
    const upperSchool=computed(()=>{
        return school.value.toUpperCase()
    })
    return {sum,school,address,bigSum,upperSchool,increment}
})
// 注意最后要暴露
export {RecordsCountStore}